﻿#ifndef CANVASITEM_H
#define CANVASITEM_H

#include <QGraphicsItem>

enum ItemMode
{
    ItemMode_Select,
    ItemMode_Edit,
    ItemMode_Resize,
};

class CanvasItem : public QGraphicsItem
{
public:
    CanvasItem(QGraphicsItem *parent = 0);
    void setItemMode(ItemMode mode);
    ItemMode getItemMode();
    virtual QRectF boundingRect() const;
    virtual void paint(QPainter *painter,
                         const QStyleOptionGraphicsItem *option,
                         QWidget *widget);
protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
    QPointF m_centerPointF;
    ItemMode m_mode;
};

#endif // CANVASITEM_H
